import { Prisma } from '@prisma/client';
import { Transform } from 'class-transformer';
import { IsDefined, IsNotEmptyObject } from 'class-validator';
import { BaseDto, BaseFindDto, BaseQueryDto } from './base.dto';

export class PublisherCreateDto extends BaseDto<Prisma.PublisherCreateInput> {}

export class PublisherUpdateDto extends BaseDto<Prisma.PublisherUpdateInput> {
  @IsDefined({ message: '条件必填' })
  @IsNotEmptyObject({ nullable: false }, { message: '条件参数必填' })
  where: Prisma.PublisherWhereUniqueInput;
}

export class PublisherRemoveDto {
  @IsDefined({ message: 'ID必填' })
  @Transform(({ value }) => Number(value))
  id: number;
}

export class PublisherFindDto extends BaseFindDto<
  Prisma.PublisherWhereUniqueInput,
  Prisma.PublisherSelect
> {}

export class PublisherQueryDto extends BaseQueryDto<Prisma.PublisherWhereUniqueInput> {}

export class PublisherUserFollowsQueryDto extends BaseQueryDto<Prisma.PublisherWhereUniqueInput> {}
